define(["Zepto", 
        "underscore", 
        "Backbone", 
        "Handlebars",  
        "text!templates/faculty/faculty-list.html" 
], function($, _, Backbone, Handlebars, template) {
	
    var FacultyView = Backbone.View.extend({

        template: Handlebars.compile(template),
        
        render: function(eventName) {
            

            this.$el.html(this.template);
            return this;
        	
        	// dubbio: ExploreListItemView OR UniversitaListItemView
        	/*$(this.el).empty();
            _.each(this.model.models, function(universita) {
                $(this.el).append(new ExploreListItemView({
                    model: universita
                }).render().el);
            }, this);
         //   $('#myList').listview('refresh');
            return this;
        */
        },

        postRender: function(eventName) {
            var scrollableframe = new iScroll('scrollableframe',
                          { useTransition:false,
                            checkDOMChanges: true,
                            hideScrollbar: true,
                            fixedScrollbar:true,
                            bounceLock: true
                            /*
                            // Decommentare se si usano form elements nella pagina
                            ,onBeforeScrollStart: function (e) {
                                var target = e.target;
                                while (target.nodeType != 1) target = target.parentNode;

                                if (target.tagName != 'SELECT' && target.tagName != 'OPTION' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA' && target.tagName != 'BUTTON')
                                    e.preventDefault();
                            }*/ }
                        );
        },


        events: {
            'touchstart .list-item': 'over',
            'touchend .list-item': 'left',
            'touchcancel .list-item': 'left',
        },

        over: function(event) {
            $(event.currentTarget).addClass('fake-active');
        },

        left: function(event) {
            $(event.currentTarget).removeClass('fake-active');
        }
            
    });
   

    return FacultyView;

});

